<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.3.1.js"></script>
    <script>
        $(function (){
           $("#b").click(function (){
                // alert(document.getElementById('pic').src); 绝对路径
               alert(document.getElementById('pic').getAttribute("src"));//相对路径
           });
        });
    </script>
</head>
<body>
<img src="../pic/1.jpg" id="pic" width="200" height="200">
<button id="b">aa</button>
</body>
</html>